using System;
using System.ComponentModel.DataAnnotations;
using InfoTech.VinhSon.Bussiness;

namespace InfoTech.VinhSon.Models
{
	[Serializable]
	public partial class CSectionModel
	{

		#region Constructor

		public CSectionModel(CSection value)
		{
			Id = value.Id;
			if(value.Category != null)
				CategoryId = value.Category.Id;
			Name = value.Name;
			Url = value.Url;
			Height = value.Height;
			Width = value.Width;
			Priority = value.Priority;
			Detail = value.Detail;
			Word = value.Word ?? false;
			Pdf = value.Pdf ?? false;
			PowerPoint = value.PowerPoint ?? false;
			Video = value.Video ?? false;
			Other = value.Other ?? false;
			Activated = value.Activated ?? false;
		}

		#endregion

		#region Fields

		private System.Int32 _Id;

		private System.Int32? _CategoryId;

		private System.String _Name;

		private System.String _Url;

		private System.Int32? _Height;

		private System.Int32? _Width;

		private System.Int32? _Priority;

		private System.String _Detail;

		private System.Boolean _Word;

		private System.Boolean _Pdf;

		private System.Boolean _PowerPoint;

		private System.Boolean _Video;

		private System.Boolean _Other;

		private System.Boolean _Activated;

		#endregion

		#region Properties

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32 Id
		{
			get
			{
				return _Id;
			}
			set
			{
				_Id = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32? CategoryId
		{
			get
			{
				return _CategoryId;
			}
			set
			{
				_CategoryId = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		[StringLength(1000)]
		public System.String Name
		{
			get
			{
				return _Name;
			}
			set
			{
				_Name = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		[StringLength(500)]
		public System.String Url
		{
			get
			{
				return _Url;
			}
			set
			{
				_Url = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32? Height
		{
			get
			{
				return _Height;
			}
			set
			{
				_Height = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32? Width
		{
			get
			{
				return _Width;
			}
			set
			{
				_Width = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Int32? Priority
		{
			get
			{
				return _Priority;
			}
			set
			{
				_Priority = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		[StringLength(1073741823)]
		public System.String Detail
		{
			get
			{
				return _Detail;
			}
			set
			{
				_Detail = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean Word
		{
			get
			{
				return _Word;
			}
			set
			{
				_Word = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean Pdf
		{
			get
			{
				return _Pdf;
			}
			set
			{
				_Pdf = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean PowerPoint
		{
			get
			{
				return _PowerPoint;
			}
			set
			{
				_PowerPoint = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean Video
		{
			get
			{
				return _Video;
			}
			set
			{
				_Video = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean Other
		{
			get
			{
				return _Other;
			}
			set
			{
				_Other = value;
			}
		}

		//[Required]
		//[Range(0, 0]
		//[StringLength(0)]
		public System.Boolean Activated
		{
			get
			{
				return _Activated;
			}
			set
			{
				_Activated = value;
			}
		}

		#endregion

		#region Operators

		public void Update(CSection value)
		{
			// value.Id = Id;
			value.Name = Name;
			value.Url = Url;
			value.Height = Height;
			value.Width = Width;
			value.Priority = Priority;
			value.Detail = Detail;
			value.Word = Word;
			value.Pdf = Pdf;
			value.PowerPoint = PowerPoint;
			value.Video = Video;
			value.Other = Other;
			value.Activated = Activated;
		}

		public static implicit operator CSectionModel(CSection obj)
		{
			return new CSectionModel(obj);
		}

		public static implicit operator CSection(CSectionModel obj)
		{
			CSection value = new CSection();
			obj.Update(value);
			return value;
		}

		#endregion

	}
}
